<script lang="ts" setup>
import type { NotifyItem } from "./type"

interface Props {
  data: NotifyItem[]
}

const props = defineProps<Props>()
</script>

<template>
  <el-empty v-if="props.data.length === 0" />
  <!-- <el-card v-else v-for="(item, index) in props.data" :key="index" shadow="never" class="card-container" >
    <template #header>
      <div class="card-header">
        <div>
          <span>
            <span class="card-title">{{ item.title }}</span>
          </span>
          <div class="card-time">
            {{ item.datetime }}
          </div>
        </div>
      </div>
    </template>
  </el-card> -->
  <el-table :data="props.data" style="width: 100%" border stripe>
    <el-table-column label="标题">
      <template #default="{ row }">
        <span class="card-title">{{ row.title }}</span>
      </template>
    </el-table-column>

    <el-table-column label="时间">
      <template #default="{ row }">
        <span class="card-time">{{ row.datetime }}</span>
      </template>
    </el-table-column>

  <!-- 可选：添加更多字段 -->
  </el-table>
</template>

<style lang="scss" scoped>
.card-container {
  margin-bottom: 10px;
  .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    .card-title {
      font-weight: bold;
      margin-right: 10px;
    }
    .card-time {
      font-size: 12px;
      color: var(--el-text-color-secondary);
    }
  }
  .card-body {
    font-size: 12px;
  }
}
.card-title {
  font-weight: bold;
  font-size: 16px;
}

.card-time {
  color: #999;
  font-size: 12px;
}
</style>
